﻿{{-- 模板名字 --}}
@extends('Layout/HomeBase')


{{-- 页面名字 --}}
 @section('title', '商品详情')


 {{-- 加载css/js文件 --}}
 @section('css')
<link type="text/css" href="{{asset('Home/css')}}/optstyle.css" rel="stylesheet" />
<link type="text/css" href="{{asset('Home/css')}}/style.css" rel="stylesheet" />
<script type="text/javascript" src="{{asset('Home/js')}}/quick_links.js"></script>
<script type="text/javascript" src="{{asset('Home/js')}}/list.js"></script>
<script type="text/javascript" src="{{asset('Home/js')}}/jquery.imagezoom.min.js"></script>
<script type="text/javascript" src="{{asset('Home/js')}}/jquery.flexslider.js"></script>

@endsection



{{-- 网页主体 --}}
@section('main')

<b class="line clear"></b>
<!-- <div class="listMain"> -->

<!--分类-->
<div class="nav-table">
    <div class="long-title"><span class="all-goods">全部分类</span></div>
    <div class="nav-cont">
        <ul>
            <li class="index">
                <a href="/">首页</a>
            </li>
            <li class="qc">
                <a href="javascript:;">闪购</a>
            </li>
            <li class="qc">
                <a href="javascript:;">限时抢</a>
            </li>
            <li class="qc">
                <a href="javascript:;">团购</a>
            </li>
            <li class="qc last">
                <a href="javascript:;">大包装</a>
            </li>
        </ul>
    </div>
</div>
<ol class="am-breadcrumb am-breadcrumb-slash">
    <li>
        <a href="/">首页</a>
    </li>
    <li>
        <a href="javascript:;">分类</a>
    </li>
    <li class="am-active">内容</li>
</ol>
<script type="text/javascript">
    $(function() {});
    $(window).load(function() {
        $('.flexslider').flexslider({
            animation: "slide",
            start: function(slider) {
                $('body').removeClass('loading');
            }
        });
    });
</script>
<div class="scoll">
    <section class="slider">
        <div class="flexslider">
            <ul class="slides">
                <li>
                    <img src="{{asset('Home/images')}}/01.jpg" title="pic" />
                </li>
                <li>
                    <img src="{{asset('Home/images')}}/02.jpg" />
                </li>
                <li>
                    <img src="{{asset('Home/images')}}/03.jpg" />
                </li>
            </ul>
        </div>
    </section>
</div>

<!--放大镜-->

<div class="item-inform">
    <div class="clearfixLeft" id="clearcontent">

        <div class="box">

            <div class="tb-booth tb-pic tb-s310">
                <a href="{{ $DetailData->pic }}"><img src="{{ $DetailData->pic }}" alt="细节展示放大镜特效" rel="{{ $DetailData->pic }}" class="jqzoom" /></a>
            </div>
            <ul class="tb-thumb" id="thumblist">

                <li class="tb-selected">
                    <div class="tb-pic tb-s40">
                        <a href="javascript:;"><img src="{{ $DetailData->pic }}" mid="{{ $DetailData->pic }}" big="{{ $DetailData->pic }}"></a>
                    </div>
                </li>
                @foreach($pic as $bb)
                    @if (!is_null($bb))
                        <li>
                            <div class="tb-pic tb-s40">
                                <a href="javascript:;"><img src="{{ $bb->pic }}" mid="{{ $bb->pic }}" big="{{ $bb->pic }}"></a>
                            </div>
                        </li>
                    @endif
                @endforeach
            </ul>
        </div>

        <div class="clear"></div>
    </div>

    <div class="clearfixRight">

        <!--规格属性-->
        <!--名称-->
        <div class="tb-detail-hd">
        <h1>
                        {{ $DetailData->gname }}
                        </h1>
            <input type="hidden" name="goods_id" value="{{ $DetailData->id }}">
            <input type="hidden" name="price_id" value="">
        </div>
        
            <div class="tb-detail-list">
                <!--价格-->
                <div class="tb-detail-price">
                    <li class="price iteminfo_price">
                        <dt>现价</dt>
                        <dd><em>¥</em><b class="sys_item_price" name="price">{{ $DetailData->price }}</b> </dd>
                    </li>
                    <li class="price iteminfo_mktprice">
                        <dt>原价</dt>
                        <dd><em>¥</em><b class="sys_item_mktprice">{{ $DetailData->price }}</b></dd>
                    </li>
                    <div class="clear"></div>
                </div>


            <!--地址-->
            <dl class="iteminfo_parameter freight">
                <dt>配送至</dt>
                <div id="show" class="iteminfo_freprice" style="width:200px;">
                    <div class="form address" style="height: 27px;width:600px;padding-top: 5px;display: inline-block;">
                        <select style="width:120px;" id="pro" name="pro">
                            <option value="-1">--请选择省份--</option>
                        </select>
                        <select style="width:120px;" id="city" name="city">
                            <option value="-1">--请选择城市--</option>
                        </select>
                        <select style="width:120px;" id="area" name="area">
                            <option value="-1">--请选择区/县--</option>
                        </select>
                    </div>
                </dl>
                <div class="clear"></div>

                <!--销量-->
                <ul class="tm-ind-panel">
                    <li class="tm-ind-item tm-ind-sellCount canClick">
                        <div class="tm-indcon"><span class="tm-label">浏览量</span><span class="tm-count">{{ $DetailData->clicknum }}</span></div>
                    </li>
                    <li class="tm-ind-item tm-ind-sumCount canClick">
                        <div class="tm-indcon"><span class="tm-label">累计销量</span><span class="tm-count">{{ $DetailData->goods_sales }}</span></div>
                    </li>
                    <li class="tm-ind-item tm-ind-reviewCount canClick tm-line3">
                        <div class="tm-indcon"><span class="tm-label">累计评价</span><span class="tm-count">300</span></div>
                    </li>
                </ul>
                <div class="clear"></div>

            <!--各种规格-->
            <dl class="iteminfo_parameter sys_item_specpara">
                <dt class="theme-login"><div class="cart-title">可选规格<span class="am-icon-angle-right"></span></div></dt>
                <dd>
                    <!--操作页面-->


                    <div class="theme-popover-mask"></div>

                    <div class="theme-popover">
                        <div class="theme-span"></div>
                        <div class="theme-poptit">
                            <a href="javascript:;" title="关闭" class="close">×</a>
                        </div>
                        <div class="theme-popbod dform">
                            <form class="theme-signin" name="loginform" action="javascript:;" method="post">

                                <div class="theme-signin-left">

                                    <div class="theme-options">
                                        <div class="cart-title" tp='color'>颜色</div>
                                        <ul>
                                            @foreach($color as $aa)
                                            <li class="sku-line" tp='color'>{{ $aa->color }}</li>
                                            @endforeach
                                        </ul>
                                    </div>
                                    <div class="theme-options">
                                        <div class="cart-title">内存</div>
                                        <ul>
                                            @foreach($memory as $aa)
                                            <li class="sku-line" tp='memory'>{{ $aa->memory }}</li>
                                            @endforeach
                                        </ul>
                                    </div>


                                        <div class="theme-options">
                                            <div class="cart-title number">数量</div>
                                            <dd>
                                                <input id="min" class="am-btn am-btn-default" name="" type="button" value="-" />
                                                <input id="text_box" name="" type="text" value="1" style="width:40px; " />
                                                <input id="add" class="am-btn am-btn-default" name="" type="button" value="+" />
                                                <span id="Stock" class="tb-hidden">库存<span class="stock" id="max_num">{{ $DetailData->goods_store }}</span>件</span>
                                            </dd>

                                    </div>
                                    <div class="clear"></div>

                                    <div class="btn-op">
                                        <div class="btn am-btn am-btn-warning">确认</div>
                                        <div class="btn close am-btn am-btn-warning">取消</div>
                                    </div>
                                </div>
                                <div class="theme-signin-right">
                                    <div class="img-info">
                                        <img src="{{asset('Home/images')}}/songzi.jpg" />
                                    </div>
                                    <div class="text-info">
                                        <span class="J_Price price-now">¥39.00</span>
                                        <span id="Stock" class="tb-hidden">库存<span class="stock">1000</span>件</span>
                                    </div>
                                </div>

                            </form>
                        </div>
                    </div>

                </dd>
            </dl>
            <div class="clear"></div>
            <!--活动  -->
            <div class="shopPromotion gold">
                <div class="hot">
                    <dt class="tb-metatit">店铺优惠</dt>
                    <div class="gold-list">
                        <p>暂无</p>
                    </div>

                </div>
                <div class="clear"></div>

            </div>
        </div>

        <div class="pay">
            <div class="">
                <!-- <a href="home.html"><span class="am-icon-home am-icon-fw">首页</span></a> -->
                <a href="javascript:;"><span class="am-icon-heart am-icon-fw">收藏</span></a>

            </div>
            <div class="clear"></div>
            <li>

                <div class="clearfix tb-btn tb-btn-basket theme-login">
                    <a id="LikBasket" title="加入购物车" href="javascript:;"><i></i>加入购物车</a>
                </div>
            </li>
            <br class="clear" />
            <p id="tip" style='width:350px;margin-left:60px;color:red;'></p>

        </div>


            </div>

        </div>
    </div>

    <script>
        $('#LikBasket').on('click', function() {
            var that = $(this);
            var buy = $('.selected');
            console.log(buy);
            var tip = $('#tip');
            if(buy.length < 2) {
                tip.html('请选择完整参数！');
                setTimeout(
                    function() {
                        tip.html('')
                    }, 3000);
                // console.log(tip.html());
                return false;
            }

            var gid = $('input[name="goods_id"]').val();
            for(var i = 0; i < buy.length; i++) {
                if(buy[i].getAttribute('tp') == 'color') {
                    var color = buy[i].innerHTML;
                } else if(buy[i].getAttribute('tp') == 'memory') {
                    var memory = buy[i].innerHTML;
                } else {
                    return false;
                }
            }
            $.post(
                '/shop/attrsearch', { 'gid': gid, 'memory': memory, 'color': color, '_token': '{{ csrf_token() }}' },
                function(msg) {
                    if(!msg) {
                        tip.html('数据出错啦！');
                        return;
                    }
                    $('input[name="price_id"]').val(msg.id);

                },
                'json',
            )

            return false;
        });
    </script>

    <div class="clear"></div>

</div>

<!--优惠套装-->
<div class="match">
   <!--  <div class="match-title">优惠套装</div>
    <div class="match-comment">
        <ul class="like_list">
            <li>
                <div class="s_picBox">
                    <a class="s_pic" href="javascript:;"><img src="{{asset('Home/images')}}/cp.jpg"></a>
                </div>
                <a class="txt" target="_blank" href="javascript:;">萨拉米 1+1小鸡腿</a>
                <div class="info-box"> <span class="info-box-price">¥ 29.90</span> <span class="info-original-price">￥ 199.00</span> </div>
            </li>
            <li class="plus_icon"><i>+</i></li>
            <li>
                <div class="s_picBox">
                    <a class="s_pic" href="javascript:;"><img src="{{asset('Home/images')}}/cp2.jpg"></a>
                </div>
                <a class="txt" target="_blank" href="javascript:;">ZEK 原味海苔</a>
                <div class="info-box"> <span class="info-box-price">¥ 8.90</span> <span class="info-original-price">￥ 299.00</span> </div>
            </li>
            <li class="plus_icon"><i>=</i></li>
            <li class="total_price">
                <p class="combo_price"><span class="c-title">套餐价:</span><span>￥35.00</span> </p>
                <p class="save_all">共省:<span>￥463.00</span></p>
                <a href="javascript:;" class="buy_now">立即购买</a>
            </li>
            <li class="plus_icon"><i class="am-icon-angle-right"></i></li>
        </ul>
    </div> -->
</div>
<div class="clear"></div>

<!-- introduce-->

<div class="introduce">
    <div class="browse">
        <div class="mc">
            <ul>
                <div class="mt">
                    <h2>看了又看</h2>
                </div>

                <li class="first">
                    <div class="p-img">
                        <a href="javascript:;"> <img class="" src="{{asset('Home/images')}}/browse1.jpg"> </a>
                    </div>
                    <div class="p-name">
                        <a href="javascript:;">
                            【三只松鼠_开口松子】零食坚果特产炒货东北红松子原味
                        </a>
                    </div>
                    <div class="p-price"><strong>￥35.90</strong></div>
                </li>

            </ul>
        </div>
    </div>
    <div class="introduceMain">
        <div class="am-tabs" data-am-tabs>
            <ul class="am-avg-sm-3 am-tabs-nav am-nav am-nav-tabs">
                <li class="am-active">
                    <a href="javascript:;">

                        <span class="index-needs-dt-txt">宝贝详情</span></a>

                </li>

                <li>
                    <a href="javascript:;">

                        <span class="index-needs-dt-txt">全部评价</span></a>

                </li>

                <li>
                    <a href="javascript:;">

                        <span class="index-needs-dt-txt">猜你喜欢</span></a>
                </li>
            </ul>

            <div class="am-tabs-bd">

                <div class="am-tab-panel am-fade am-in am-active">
                    <div class="J_Brand">

                        <div class="attr-list-hd tm-clear">
                            <h4>产品参数：</h4></div>
                        <div class="clear"></div>
                        <ul id="J_AttrUL">
                        @foreach($doc as $te)
                            <li title="">{{$te}}</li>
                           @endforeach
                        </ul>
                        <div class="clear"></div>
                    </div>

                  <!--   <div class="details">
                        <div class="attr-list-hd after-market-hd">
                            <h4>商品细节</h4>
                        </div>
                        <div class="twlistNews">
                            <img src="{{asset('Home/images')}}/tw1.jpg" />
                                <img src="{{asset('Home/images')}}/tw2.jpg" />
                                <img src="{{asset('Home/images')}}/tw3.jpg" />
                                <img src="{{asset('Home/images')}}/tw4.jpg" />
                                <img src="{{asset('Home/images')}}/tw5.jpg" />
                                <img src="{{asset('Home/images')}}/tw6.jpg" />
                                <img src="{{asset('Home/images')}}/tw7.jpg" />
                        </div>
                    </div> -->
                    <div class="clear"></div>

                </div>

                <div class="am-tab-panel am-fade">

                    <div class="clear"></div>
                    <div class="tb-r-filter-bar">
                        <ul class=" tb-taglist am-avg-sm-4">
                            <li class="tb-taglist-li tb-taglist-li-current">
                                <div class="comment-info">
                                    <span>全部评价</span>
                                    <span class="tb-tbcr-num">(32)</span>
                                </div>
                            </li>

                            <li class="tb-taglist-li tb-taglist-li-1">
                                <div class="comment-info">
                                    <span>好评</span>
                                    <span class="tb-tbcr-num">(32)</span>
                                </div>
                            </li>

                            <li class="tb-taglist-li tb-taglist-li-0">
                                <div class="comment-info">
                                    <span>中评</span>
                                    <span class="tb-tbcr-num">(32)</span>
                                </div>
                            </li>

                            <li class="tb-taglist-li tb-taglist-li--1">
                                <div class="comment-info">
                                    <span>差评</span>
                                    <span class="tb-tbcr-num">(32)</span>
                                </div>
                            </li>
                        </ul>
                    </div>
                    <div class="clear"></div>

                    <ul class="am-comments-list am-comments-list-flip">

                    <!-- xunhuan -->
                        <li class="am-comment">
                            <!-- 评论容器 -->
                            <a href="">
                                <!-- 评论者头像 -->
                                <img class="am-comment-avatar" src="{{asset('Home/images')}}/hwbn40x40.jpg" />
                            </a>

                            <div class="am-comment-main">
                                <!-- 评论内容容器 -->
                                <header class="am-comment-hd">
                                    <!--<h3 class="am-comment-title">评论标题</h3>-->
                                    <div class="am-comment-meta">
                                        <!-- 评论元数据 -->
                                        <a href="javascript:;link-to-user" class="am-comment-author">b***1 (匿名)</a>
                                        <!-- 评论者 -->
                                        评论于
                                        <time datetime="">2015年11月02日 17:46</time>
                                    </div>
                                </header>

                                <div class="am-comment-bd">
                                    <div class="tb-rev-item " data-id="255776406962">
                                        <div class="J_TbcRate_ReviewContent tb-tbcr-content ">
                                            摸起来丝滑柔软，不厚，没色差，颜色好看！买这个衣服还接到诈骗电话，我很好奇他们是怎么知道我买了这件衣服，并且还知道我的电话的！
                                        </div>
                                        <div class="tb-r-act-bar">
                                            颜色分类：柠檬黄&nbsp;&nbsp;尺码：S
                                        </div>
                                    </div>

                                </div>
                                <!-- 评论内容 -->
                            </div>
                        </li>
                        <!-- xunhuan -->


                    </ul>

                    <div class="clear"></div>

                    <!--分页 -->
                    <ul class="am-pagination am-pagination-right">
                        <li class="am-disabled">
                            <a href="javascript:;">&laquo;</a>
                        </li>
                        <li class="am-active">
                            <a href="javascript:;">1</a>
                        </li>
                        <li>
                            <a href="javascript:;">2</a>
                        </li>
                        <li>
                            <a href="javascript:;">3</a>
                        </li>
                        <li>
                            <a href="javascript:;">4</a>
                        </li>
                        <li>
                            <a href="javascript:;">5</a>
                        </li>
                        <li>
                            <a href="javascript:;">&raquo;</a>
                        </li>
                    </ul>
                    <div class="clear"></div>

                    <div class="tb-reviewsft">
                        <div class="tb-rate-alert type-attention">购买前请查看该商品的
                            <a href="javascript:;" target="_blank">购物保障</a>，明确您的售后保障权益。</div>
                    </div>

                </div>

                <div class="am-tab-panel am-fade">
                    <div class="like">
                        <ul class="am-avg-sm-2 am-avg-md-3 am-avg-lg-4 boxes">
                            @foreach($goods as $kk)
                            <li>
                                <a href="/detail/{{ $kk->id }}">
                                <div class="i-pic limit">
                                    <img src="{{ $kk->pic }}" style="width:215px;height: 215px; "/>
                                    <p> {{ $kk->gname }}
                                        <span>{{ $kk->memory }}&nbsp;{{ $kk->price }}</span></p>

                                    <p class="price fl">
                                        <b>¥</b>
                                        <strong>{{ $kk->price }}</strong>
                                    </p>
                                </div></a>
                            </li>
                            @endforeach
                        </ul>
                    </div>
                    <div class="clear"></div>


                    <div class="clear"></div>

                </div>

            </div>

        </div>

        <div class="clear"></div>

    </div>

</div>
</div>
@endsection



{{-- 页脚js代码 --}}
@section('bottom-js')

<script type="text/javascript">
    $(document).ready(function() {
        $(".jqzoom").imagezoom();
        $("#thumblist li a").click(function() {
            $(this).parents("li").addClass("tb-selected").siblings().removeClass("tb-selected");
            $(".jqzoom").attr('src', $(this).find("img").attr("mid"));
            $(".jqzoom").attr('rel', $(this).find("img").attr("big"));
        });
    });
</script>

{{--加入购物车[fanzekai]--}}
<script>
  $("#LikBasket").click(function () {
    var id = $("input[name='goods_id']").val();
    var price =  $("b[name='price']").html()
    var num = $('#text_box').val();
    var buy = $('.selected');
     var tip = $('#tip');
     if ( buy.length < 2 ) {
                    tip.html('请选择完整参数！');
                    setTimeout(
                       function () {
                         tip.html('')
                    },3000);
                    return false;
                }
    var token  = "{{csrf_token()}}";
    for (var i = 0 ; i< buy.length ; i++) {
        if (buy[i].getAttribute('tp') == 'color') {
            var color = buy[i].innerHTML;
        } else if (buy[i].getAttribute('tp') == 'memory') {
            var memory = buy[i].innerHTML;
        } else {
            return false;
        }
    }
    var num = $('#text_box').val();
    $.ajax({
        type:'post',
        url:"{{url('/addCart')}}",
        data: {"num":num,'memory' :memory ,'price':price, 'color' : color,  "id":id,"_token":token},
        dataType:'json',
        success:function(data){
          if(data.code==2000){
              alert(data.msg);
          }

        }
    });
  })
</script>



    


{{-- 张健领 --}}
<script>
    var box = $("#text_box");
    var num = $('#max_num').text();
    var max = parseInt(num);
    $("#add").click(function() {
        if(box.val() >= max) {
            box.val(max - 1);
        }
    });

    $("#text_box").blur(function() {
        var vas = Number(box.val());
        var num = $('#max_num').text();
        var max = parseInt(num);
        if(isNaN(vas)) {
            box.val(1);
        } else if(vas <= 0) {
            box.val(1);
        } else if(vas >= max) {
            box.val(max);
        } else {
            box.val(vas);
        }
    });

    {{-- 城市三级联动 --}}

    $.post(
        "/shop/area", { 'upid': '0', '_token': '{{ csrf_token() }}' },
        function(msg) {
            // console.log(msg);
            var str = '';
            for(var i = 0; i < msg.data.length; i++) {
                str += '<option value="' + msg.data[i].id + '">' + msg.data[i].name + '</option>';
            }
            $('#pro').append(str);
        },
        'json'
    );

    $('div#show').on('change', 'select', function() {
        var that = $(this);
        if($('#pro').val() < 0) {
            $('#city').empty();
            $('#city').append("<option value='-1'>--请选择城市--</option>");
            $('#area').empty();
            $('#area').append("<option value='-1'>--请选择区/县--</option>");
            return false;
        }
        if(that.attr('name') != "area") {
            that.next('select')[0].options.length = 0;
        }

        if($('#city').val() < 0) {
            $('#area').empty();
            $('#area').append("<option value='-1'>--请选择区/县--</option>");
        }

        var currentId = $(this).val();

        // console.log(currentId);

        $.post(
            '/shop/area', { 'upid': currentId, '_token': '{{ csrf_token() }}' },
            function(msg) {
                var str = '';
                // console.log(msg);
                for(var i = 0; i < msg.data.length; i++) {

                    str += '<option value="' + msg.data[i].id + '">' + msg.data[i].name + '</option>';
                }
                if(that.attr('name') == 'pro') {
                    that.next('select').append("<option value='-1'>--请选择城市--</option>");
                }
                that.next('select').append(str);
            },
            'json',

        );
        if(that.attr('name') == 'pro') {
            $('#area').empty();
            $('#area').append("<option value='-1'>--请选择区/县--</option>");
        }
    })


                                            var attr = new Array();
                                            var prcval = $('.sys_item_price').html();
                                             var prc = $('.sys_item_price');

                                          $("li[tp='memory']").on('click' ,function () {
                                             var sed = $('.selected');
                                             var that = $(this);
                                              var hid = $('input[name="goods_id"]');
                                             if (that.hasClass('selected')) {
                                                    prc.html(prcval);
                                                    return;
                                             }
                                                var tp = that.attr('tp');
                                                var val = that.html();
                                                $.post(
                                                        '/shop/attr',
                                                         {
                                                            'tp' :  tp,
                                                            'gid' : hid.val(),
                                                            'val' : val,
                                                            '_token': '{{ csrf_token() }}'},
                                                         function (msg) {
                                                               // console.log(msg);
                                                               prc.html(msg.price)
                                                         },
                                                        'json',
                                                    )
                                          })

                                          var store = $('#max_num');
                                          // var num = $('#max_num').html();
                                          // console.log();
                                          $("li[tp='color']").on('click' ,function () {
                                             var sed = $('.selected');
                                             var that = $(this);
                                               var hid = $('input[name="goods_id"]');

                                             if (that.hasClass('selected')) {
                                                    store.html(num);
                                                    return;
                                             }
                                                var tp = that.attr('tp');
                                                var val = that.html();
                                                $.post(
                                                        '/shop/attr',
                                                         {
                                                            'tp' :  tp,
                                                            'gid' : hid.val(),
                                                            'val' : val,
                                                            '_token': '{{ csrf_token() }}'},
                                                         function (msg) {
                                                              $('#max_num').html(msg.store);
                                                         },
                                                        'json',
                                                    )
                                          })
    var attr = new Array();
    var prcval = $('.sys_item_price').html();
    var prc = $('.sys_item_price');

    $("li[tp='memory']").on('click', function() {
        var sed = $('.selected');
        var that = $(this);
        var hid = $('input[name="goods_id"]');
        if(that.hasClass('selected')) {
            prc.html(prcval);
            return;
        }
        var tp = that.attr('tp');
        var val = that.html();
        $.post(
            '/shop/attr', {
                'tp': tp,
                'gid': hid.val(),
                'val': val,
                '_token': '{{ csrf_token() }}'
            },
            function(msg) {
                // console.log(msg);
                prc.html(' ' + msg.price)
            },
            'json',
        )
    })

    var store = $('#max_num');

    $("li[tp='color']").on('click', function() {
        var sed = $('.selected');
        var that = $(this);
        var hid = $('input[name="goods_id"]');

        if(that.hasClass('selected')) {
            store.html(num);
            return;
        }
        var tp = that.attr('tp');
        var val = that.html();
        $.post(
            '/shop/attr', {
                'tp': tp,
                'gid': hid.val(),
                'val': val,
                '_token': '{{ csrf_token() }}'
            },
            function(msg) {
                $('#max_num').html(msg.store);
                $('#text_box').val(1);
            },
            'json',
        )
    })
</script>

@endsection
